home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / oath.lha / oath / test / ms0.cc < prev    next >
C/C++ Source or Header  |  1991-08-29  |  2KB  |  81 lines

  1. #include "oath/minString.h"
  2.  
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. #include "../src/ensure.cc"
  6.  
  7. #include "../src/typeRegisterP.cc"
  8.  
  9. #include "../src/exportP.cc"
  10.  
  11. #include "../src/oathCore.cc"
  12.  
  13. #include "../src/obj.cc"
  14.  
  15. #include "../src/token.cc"
  16.  
  17. #include "../src/character.cc"
  18.  
  19. #include "../src/bag.cc"
  20.  
  21. #include "../src/queue.cc"
  22.  
  23. #include "../src/seq.cc"
  24.  
  25. #include "../src/fifoQueue.cc"
  26.  
  27. #include "../src/deq.cc"
  28.  
  29. #include "../src/list.cc"
  30.  
  31. #include "../src/string.cc"
  32.  
  33. #include "../src/dlcNodeP.cc"
  34.  
  35. #include "../src/minString.cc"
  36.  
  37. /////////////////////////////////////////////////////////////////////////////
  38. // Test of minStrings
  39.  
  40. main()
  41.    {characterA R = characterA::make('r');
  42.     characterA S = characterA::make('s');
  43.     characterA T = characterA::make('t');
  44.     characterA L = characterA::make('l');
  45.     characterA N = characterA::make('n');
  46.     characterA E = characterA::make('e');
  47.     characterA A = characterA::make('a');
  48.  
  49.     stringA Star   = minStringA::make() << T << A << R;
  50.     cout << Star.am() << "\t(" << Star.hash() << ")" << endl;
  51.  
  52.     stringA Sstare = minStringA::make() << S << Star << E;
  53.     cout << Sstare.am() << "\t(" << Sstare.hash() << ")" << endl;
  54.  
  55.     stringPosA Pstare = Sstare.makePos();
  56.     cout << "First char is " << *Pstare << endl;
  57.     Pstare.findMatch("tar");
  58.     cout << "Char after tar is " << *Pstare << endl;
  59.  
  60.     Pstare.reset();
  61.     if(Pstare.canMatch("sta"))
  62.         cout << "It can match 'sta', if you wish." << endl;
  63.  
  64.     if(!!Pstare.match(""))
  65.         cout << "It just matched nothing successfully." << endl;
  66.  
  67.     ///
  68.  
  69.     char * Buffer = new char [50];
  70.     for(int I = 0; I < 5; I++)
  71.        {for(int J = 0; J < 10; J++)
  72.             Buffer[I*10 + J] = J;
  73.        }
  74.     stringA Sbuffer = minStringA::make(Buffer, Buffer+42);
  75.     cout << "Sbuffer is " << Sbuffer.count() << " char's long." << endl;
  76.     char * Buffer2 = new char [40];
  77.     Sbuffer.charStarX(Buffer2, 40);
  78.     if(!memcmp(Buffer, Buffer2, 40))
  79.         cout << "Success!  The buffers are the same!" << endl;
  80.   
  81.    }